home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
backup
/
kbackup-.000
/
KBackup-1.2.7.tar
/
KBackup
/
src
/
autodetect_src
next >
Wrap
Text File
|
1996-02-13
|
2KB
|
102 lines
AUTODETECT_SRC_LOADED=YES
test_tape_device_II()
{
tape="$1"
InfoBox "Testing $tape:\nrewinding..."
my_mt -f "$tape" rewind 2>/dev/null
if [ $? = 0 ]
then
InfoBox "Testing $tape:\nwriting 1st pattern..."
( echo "Tape device is working correctly (non-rewinding)." | \
$DD of="$tape" obs=1024 conv=sync ) 2>/dev/null
InfoBox "Testing $tape:\nwriting 2nd pattern..."
( echo "Tape device is incompatible with KBackup (rewinding)." | \
$DD of="$tape" obs=1024 conv=sync ) 2>/dev/null
InfoBox "Testing $tape:\nrewinding... "
my_mt -f "$tape" rewind 2>/dev/null
InfoBox "Testing $tape:\nreading... "
cat "$tape" | $FGREP "non-rewinding" >/dev/null 2>/dev/null
return $?
else
return 1 # error
fi
}
#
# scans system for KBackup compatible tape devices and returns
# the list of device names in $TMP/$TMPFILE2
#
autodetect_tape_device_II()
{
$DIALOG --title " Warning! " --yesno \
"
Please insert an empty tape into your drive.
This test will erase any data on the tape!
Are you sure that you want to continue?" 10 50
if [ $? != 0 ]
then
return
fi
InfoBox "Looking for devices..."
devices=`ls /dev/[n]st* /dev/[r]mt* /dev/*tape /dev/n[r]ft* /dev/[r]ft* /dev/*mt* | sort | uniq`
for i in $devices
do
InfoBox "Looking for: $i"
$DD if="$i" of=/dev/null bs=0 count=0 2>$TMP/$TMPFILE >/dev/null
$FGREP "No such device" $TMP/$TMPFILE >/dev/null
if [ $? != 0 ]
then
echo "$i" >>$TMP/$TMPFILE2
fi
done
devices=`cat $TMP/$TMPFILE2`
count=1
echo >$TMP/$TMPFILE2
tape_detected=NO
for i in $devices
do
test_tape_device_II "$i"
if [ $? = 0 ]
then
echo "$i ok" >>$TMP/$TMPFILE2
tape_detected=YES
fi
done
}
autodetect_tape_menu()
{
if [ "$tape_detected" = "YES" ]
then
$DIALOG --title " Autodetection " --menu "
These devices have been detected as being
available and compatible for use with KBackup.
Please choose one from the list.
" 20 60 6 `cat $TMP/$TMPFILE2` 2>$TMP/$DIALOGFILE
if [ $? = 0 ]
then
device=`cat $TMP/$DIALOGFILE`
device_type=TAPE
Configuration_changed=YES
fi
else
MessageBox "
No compatible tape device found.
"
fi
}